


var twoSum = function(nums, target) {
   var map = {};
   for(let size = 0; size < nums.length; size++) {
     // let num of nums

     let num = nums[size];
     let other = target - num;
     // console.log(" num:" + num + " other:" + other );
     if(map[other] != null) {
       return [size, map[other]];
     } else {
       map[num] = size;
       // console.log(" map put num:" + num + " size:" + size );
     }
   }
   return [0];
}

var test1 = [2, 7, 11, 15];
var target1 = 9;
var result1 = twoSum(test1, target1);
console.log(" test1:" + test1 + "  result1:" + result1);